Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move more model classes to records #108

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Move more model classes to records #108

merged 1 commit into from
Jan 18, 2024

Conversation

Tyrrrz
Copy link
Contributor

@Tyrrrz Tyrrrz commented Jan 16, 2024

Found a way to assign inline docs to properties -- using the <para> on the type definition.

Migrated some of our older models to use { get; init; } and/or record where possible. This is a breaking change to models related to event logging, but those have not been released yet.

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (b39384d) 63.76% compared to head (a2807c2) 63.75%.

Files Patch % Lines
src/Passwordless/Models/Credential.cs 0.00% 18 Missing ⚠️
src/Passwordless/Models/ApplicationEvent.cs 0.00% 9 Missing ⚠️
src/Passwordless/Models/SetAliasRequest.cs 0.00% 3 Missing ⚠️
src/Passwordless/Models/GetEventLogResponse.cs 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   63.76%   63.75%   -0.02%     
==========================================
  Files          43       43              
  Lines         723      720       -3     
  Branches       58       57       -1     
==========================================
- Hits          461      459       -2     
  Misses        253      253              
+ Partials        9        8       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -18,7 +18,7 @@ public async Task I_can_view_application_event_logs_when_event_logs_are_enabled(

// Act
var response = await passwordless.GetEventLogAsync(
new GetEventLogRequest { PageNumber = 1, NumberOfResults = 100 }
new GetEventLogRequest(1, 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking-nit: I find this less readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same. It's possible to keep the same signature with required and init but that involves more boilerplate though. We can still do it if it's important.

@Tyrrrz
Copy link
Contributor Author

Tyrrrz commented Jan 17, 2024

@jrmccannon curious about your opinion since you added some of these models

@jrmccannon
Copy link
Contributor

A lot of the default values were mainly so that if the classes were newed up, we could avoid some null reference exceptions. Since we're now enforcing the records to be created, you would have to explicitly assign null to the newed up record.

@Tyrrrz
Copy link
Contributor Author

Tyrrrz commented Jan 18, 2024

@abergs @jrmccannon do you think this is approvable or would you rather I revert something?

@Tyrrrz Tyrrrz merged commit 30273e1 into main Jan 18, 2024
7 checks passed
@Tyrrrz Tyrrrz deleted the normalize-models branch January 18, 2024 14:01
jonashendrickx added a commit that referenced this pull request Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants